import request from '@/utils/request'

interface ResponseData {
  list: [],
  totalPage: 0,
  total: 0,
}

/**
 * 创建订单
 * @param params
 * @returns
 */
export const createOrder = <T>(data?: any) =>
  request.post<T>('/admin-core/web/order/v1/create', data)

/**
 * 作废订单
 * @param params
 * @returns
 */
export const invalidOrder = <T>(data?: any) =>
  request.post<T>('/admin-core/web/order/v1/invalid', data)

/**
 * 分页查询订单
 * @param params
 * @returns
 */
export const orderQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/order/v1/queryPage', data)

/**
 * 更新订单
 * @param params
 * @returns
 */
export const updateOrder = <T>(data?: any) =>
  request.post<T>('/admin-core/web/order/v1/update', data)

// 账号相关接口
/**
 * 分页查询账号
 * @param params
 * @returns
 */
export const accountQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/account/v1/queryPage', data)

//  新增查询所有合作方接口  /admin-core/web/partner/v1/queryList
export const queryPartnerList = <T>(data?: any) =>
  request.post<T>('/admin-core/web/partner/v1/queryList', data)

/**
 * 删除账号信息
 * @param params
 * @returns
 */
export const removeAccount = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/removeAccount', data)

/**
 * 保存账号信息
 * @param params
 * @returns
 */
export const saveAccount = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/save', data)

/**
 * 更新账号信息
 * @param params
 * @returns
 */
export const updateAccount = <T>(data?: any) =>
  request.post<T>('/admin-core/web/account/v1/update', data)


// 合作方相关接口

/**
 * 分页查询合作方
 * @param params
 * @returns
 */
export const partnerQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/partner/v1/queryPage', data)

/**
 * 删除合作方账号信息
 * @param params
 * @returns
 */
export const removePartnerAccount = <T>(data?: any) =>
  request.post<T>('/admin-core/web/partner/v1/removeAccount', data)

/**
 * 保存合作方信息
 * @param params
 * @returns
 */
export const savePartner = <T>(data?: any) =>
  request.post<T>('/admin-core/web/partner/v1/save', data)

/**
 * 更新合作方信息
 * @param params
 * @returns
 */
export const updatePartner = <T>(data?: any) =>
  request.post<T>('/admin-core/web/partner/v1/update', data)


// 账号和车型关联配置相关接口

/**
 * 查询分页账号和车型关联
 * @param params
 * @returns
 */
export const accountModelQuery = <T>(data?: any) =>
  request.post<ResponseData>('/admin-core/web/accountModel/v1/queryPage', data)

/**
 * 删除账号和车型关联
 * @param params
 * @returns
 */
export const removeAccountModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/accountModel/v1/removeAccount', data)

/**
 * 保存账号和车型关联
 * @param params
 * @returns
 */
export const saveAccountModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/accountModel/v1/save', data)

/**
 * 更新账号和车型关联
 * @param params
 * @returns
 */
export const updateAccountModel = <T>(data?: any) =>
  request.post<T>('/admin-core/web/accountModel/v1/update', data)


/**
 * 合作方模版下载
 * @param params
 * @returns
 */
export const getPartnerTemplate = <T>() =>
  request.get<T>('/admin-core/template/合作方及账号信息导入模版.xlsx', { responseType: 'blob' })

//
